package me.GJxunhuan.demo;

import java.util.Scanner;

public class Test4 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        System.out.println("请输入一个数字");
        int a = sc.nextInt();
        int flag = 1;
        for (int i = 2; i < Math.sqrt(a); i++) {
            if (a % i == 0) {
                flag = 0;
                System.out.println(a + "不是质数");
                break;
            }
        }
        if (flag == 1) {
            System.out.println(a + "是质数");

        }
    }
}
